-
Notifications
You must be signed in to change notification settings - Fork 4
Add color map to DirectoryItemInput so we can give different color by equipmentType and add Fields needed for contingency list by filter #839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… equipment type and add new Fields for Aleas by filter Signed-off-by: basseche <[email protected]>
Signed-off-by: basseche <[email protected]>
Signed-off-by: basseche <[email protected]>
b0f47df
to
5b94394
Compare
Signed-off-by: basseche <[email protected]>
5b94394
to
bf01977
Compare
|
fields: elements, | ||
append, | ||
remove, | ||
} = useFieldArray({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
À mon avis il n'y a plus besoin de renommer fields ici vu qu'il est déjà renommé en bas, autant garder le nom d'origine ici plutôt que de le changer 2 fois
{elementsWithMetaData.map((item, index) => ( | ||
<Box key={`Box${item.id}`} sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}> | ||
<Chip | ||
key={item.id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il y a toujours besoin de la prop key vu qu'il a été ajouté sur la box au-dessus ?
item.specificMetadata?.equipmentType && | ||
equipmentColorsMap?.has(item.specificMetadata?.equipmentType) | ||
? equipmentColorsMap.get(item.specificMetadata.equipmentType) | ||
: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item.specificMetadata?.equipmentType && | |
equipmentColorsMap?.has(item.specificMetadata?.equipmentType) | |
? equipmentColorsMap.get(item.specificMetadata.equipmentType) | |
: undefined, | |
equipmentColorsMap?.get(item.specificMetadata?.equipmentType) | |
Corrigez moi si je me trompe mais je crois que du coup ça revient exactement a la même chose
} | ||
/> | ||
{elementsWithMetaData.map((item, index) => ( | ||
<Box key={`Box${item.id}`} sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est pas quelque chose dont on risque d'avoir besoin ailleurs ? il faudrait peut-être sortir ce code et en faire un composant ?
<Chip | ||
key={item.id} | ||
size="small" | ||
sx={{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Au lieu d'utiliser sx et la variable css backgroundcolor, pas possible d'utiliser tout simplement color de Chip ?
J'ai pas testé mais à mon avis ça doit être la même chose.
https://mui.com/material-ui/api/chip/#props
} | ||
/> | ||
{elementsWithMetaData.map((item, index) => ( | ||
<Box key={`Box${item.id}`} sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Petite question, pourquoi mettre box devant l'id ?
Je pense que c'est moins performant que de mettre directement l'id.
} = useFieldArray({ | ||
name, | ||
}); | ||
const elementsWithMetaData: TreeViewFinderNodeProps[] = elements as unknown as TreeViewFinderNodeProps[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On est sûr que les champs correspondent toujours à ce type TreeViewFinderNodeProps ?
J'ai essayé de remonter pour voir où se composant était utilisé et franchement j'ai toujours aucune idée d'à quoi ressemble ce formulaire.
En tout cas rien que le nom est bizarre, d'après le nom c'est censé être utilisé uniquement dans l'arbre mais je vois qu'il est un peu partout...
return ''; | ||
} | ||
return equipmentType !== EquipmentType.HVDC_LINE | ||
? (BASE_EQUIPMENTS[equipmentType as EquipmentType]?.label ?? '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourquoi ne pas rajouter ce type d'équipement dans BASE_EQUIPMENTS ?
No description provided.